# coding: utf-8

import pandas as pd

## concat
# df1 = pd.DataFrame({'A':['A1', 'A2', 'A3', 'A4']
#                    ,'B':['B1', 'B2', 'B3', 'B4']
#                    ,'C':['C1', 'C2', 'C3', 'C4']
#                    ,'D':['D1', 'D2', 'D3', 'D4']
#                    ,'E':['E1', 'E2', 'E3', 'E4']
#                     })
# df2 = pd.DataFrame({'A':['A5', 'A6', 'A7', 'A8']
#                    ,'B':['B5', 'B6', 'B7', 'B8']
#                    ,'C':['C5', 'C6', 'C7', 'C8']
#                    ,'D':['D5', 'D6', 'D7', 'D8']
#                    ,'F':['F5', 'F6', 'F7', 'F8']
#                     })

# 合并行
# 默认参数
# axis=0 按行合并
# join=outer
# ignore_index=False 保留原来的index
# print(pd.concat([df1, df2]))
# print(pd.concat([df1, df2], join='inner', ignore_index=True))

# 合并列
# s1 = pd.Series(['G1', 'G2', 'G3', 'G4'], index=[0, 1, 2, 3])
# print(s1.head())
# print(pd.concat([df1, s1], axis=1))
#
# s2 = pd.Series(['H1', 'H2', 'H3', 'H4'], index=[0, 1, 2, 3])
# print(pd.concat([df1, s1, s2], axis=1))
#
# print(pd.concat([s1, s2], axis=1))

## append pandas 2.0已弃用
df1 = pd.DataFrame([[1, 2],[3, 4]], columns=['A', 'B'])
print(df1.head())
df2 = pd.DataFrame([[5,6],[7,8]], columns=['A', 'B'])
print(df1._append(df2))
